<script>
    $(document).ready(function() {
        $('#startPicker,#endPicker').datepick({
            onSelect: customRange, dateFormat: 'yyyy-mm-dd'});

        function customRange(dates) {
            if (this.id == 'startPicker') {
                $('#endPicker').datepick('option', 'minDate', dates[0] || null);
            }
            else {
                $('#startPicker').datepick('option', 'maxDate', dates[0] || null);
            }
        }

        $('#frm_filter a').bind('click', function() {
            var d = new Date();
            var fd = this.id;
            var nowd = d.getFullYear() + "-" + (d.getMonth() + 1) + "-" + d.getUTCDate();

            switch (fd) {
                case "yestday":
                    var yestday = reduceByTransDate(nowd, 1);
                    $('#startPicker').val(yestday);
                    $('#endPicker').val(yestday);
                    $('#frm_filter').submit();
                    break;
                case "week":
                    var week = reduceByTransDate(nowd, 7);
                    $('#startPicker').val(week);
                    $('#endPicker').val(nowd);
                    $('#frm_filter').submit();
                    break;
                case "month":
                    var month = reduceByTransDate(nowd, 30);
                    $('#startPicker').val(month);
                    $('#endPicker').val(nowd);
                    $('#frm_filter').submit();
                    break;
                default:
                    break;
            }

        });
    });
</script>
<article class="module width_full filter">
    <header>
        <h3>过滤条件</h3>
    </header>
    <form id="frm_filter" accept="" method="get">
        <p>
            <a href="javascript:void(0)" id="yestday">昨天</a>
            <a href="javascript:void(0)" id="week">最近7天</a>
            <a href="javascript:void(0)" id="month">最近30天</a>
            <input type="text" id="startPicker" name="startPicker" size="10">to
            <input type="text" id="endPicker" name='endPicker' size="10">
            <input type="submit" value="查询">
        </p>
    </form>
</article>